package tool

import (
	"math/rand"
	"strconv"
	"time"
)

const A = int('a')

func GetRandomCode(len int) string {
	rand.Seed(time.Now().Unix())
	var code string
	for i := 0; i < len; i++ {
		num := rand.Intn(36)
		if num > 25 {
			code += strconv.Itoa(num - 26)
		} else {

			code += string(rune(A + num))
		}

	}
	return code
}
